home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
addnums.zip
/
ADDNUMS.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-09-13
|
3KB
|
117 lines
' ADDNUMS - Adds Numbers to BASIC program which has none
' Version 1.00 09/05/86
' Version 1.01 09/12/90 P.D.Q. changes.
' (C) Copyright 1986, 1990 by William D. Hileman
' Route 3, Box 467
' Trenton, FL 32693
' (904) 463-1680
'
' and Knowledge Applied Technologies, Inc.
' 502 NW 75th Street, Suite #214
' Gainesville, FL 32607
declare function pdqexist%(fl.spec$)
defint a-z
version$="1.01"
versdate$="09/12/90"
cls
print "┌─────────────────────────────────────────────────┐"
print "│ ADDNUMS - Number Inserter Version ";version$;" ";versdate$;" │"
print "│ (C) Copyright 1986, 1990 by William D. Hileman │"
print "└─────────────────────────────────────────────────┘"
print
' Get source filename
src.name$=ucase$(ltrim$(rtrim$(command$)))
if src.name$="" then
line input "Enter Source Filename: ";src.name$
src.name$=ucase$(ltrim$(rtrim$(src.name$)))
print
elseif src.name$="?" then
gosub help
goto done
end if
if src.name$="" then
goto done
end if
x=instr(src.name$,".")
if x=0 then
dest.name$=src.name$+".NUM"
src.name$=src.name$+".BAS"
elseif mid$(src.name$,x+1)="NUM" then
print "Source file cannot have extension 'NUM'!"
beep
goto done
else
dest.name$=left$(src.name$,x)+"NUM"
end if
if not pdqexist(src.name$) then
print "Source file '";src.name$;"' not found!"
beep
goto done
end if
open src.name$ for input as #1
open dest.name$ for output as #2
print "Creating File: '";dest.name$;"'";
lin%=0
sup%=0
while not eof(1)
line input #1,i$
if sup% then
o$=space$(len(ltrim$(str$(lin%))))+" "+i$
else
lin%=lin%+1
o$=ltrim$(str$(lin%))+" "+i$
end if
print #2,o$
if right$(i$,1)="_" then
sup%=-1
else
sup%=0
end if
wend
print
done:
close
end
' Display help message (command line syntax)
help:
print "┌─────────────────────────────────────────────────────────────────────┐"
print "│ ADDNUMS is a utility which reads an ASCII file and creates a file │"
print "│ with the same filename and the extension '.NUM'. This new file │"
print "│ has line numbers starting with '1' on all logical lines. If the │"
print "│ last character on the line is an underscore (_), the line following │"
print "│ it will not contain a line number, but will be indented the proper │"
print "│ number of spaces. This utility is designed to debug BASIC programs │"
print "│ written without line numbers, whose error codes during testing are │"
print "│ ambiguous. The default source file extension is '.BAS'. │"
print "├─────────────────────────────────────────────────────────────────────┤"
print "│ ADDNUMS accepts the following syntax: │"
print "├─────────────────────────────────────────────────────────────────────┤"
print "│ ADDNUMS ? - displays this message │"
print "│ ADDNUMS d:\path\filename.ext - creates d:\path\filename.NUM │"
print "│ ADDNUMS - prompts for source filespec │"
print "└─────────────────────────────────────────────────────────────────────┘"
return